
package ch.hearc.coursJava.moo.heritage.animals;

public abstract class Animals
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/

	public Animals(String nom)
		{
		this.nom = nom;
		}

	public Animals(Animals source)
		{
		this(source.nom);
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Abstract						*|
	\*------------------------------------------------------------------*/

	public abstract String mange();

	public abstract Animals cloneOf();

	// il est interdit d'instancier des classes abstraites

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	@Override
	public String toString()
		{
		return this.nom + " mange " + this.mange() + "\n" + this.nomClasse() + "\n";
		}

	/*public String nomClasse()
		{
		Class<? extends Animals> parcour = this.getClass();
		StringBuilder str = new StringBuilder();
		StringBuilder retour = new StringBuilder("\n");
		while(!parcour.getSimpleName().equals(Object.class.getSimpleName()))
			{
			  str.append(parcour.getSimpleName()).append(retour);
			  parcour = (Class<? extends Animals>)parcour.getSuperclass();
			}
		return str.toString();
		}*/
	public String nomClasse()
		{
		return Animals.class.getSimpleName() + " : ";
		}

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	public String getNom()
		{
		return this.nom;
		}

	/*------------------------------*\
	|*				Set				*|
	\*------------------------------*/

	public void setNom(String nom)
		{
		this.nom = nom;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	public String nom;
	}
